package Demo3;

public class Main18 {
    public static void main(String[] args) throws InterruptedException {
        Thread main=Thread.currentThread();
        Thread t=new Thread(()->{
            try {
                main.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            while(true){
               System.out.println("hello thread");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });
        t.start();
        System.out.println(t.getState());
    }
}
